{$DEFINE SST_SHLWAPIVER6PT0}
{$IFDEF SST_SHLWAPIVER6PT0}
PROCEDURE TForm4.TestShlWAPIStrStrNIW(Sender : TObject);
VAR strtosrchfor : WideString;
VAR txttosearch : WideString;
VAR uptocharnum : UINT;
VAR apiretptr : POINTER;
VAR newinfoline : STRING;
BEGIN
strtosrchfor := '';
txttosearch := '';
uptocharnum := 0;
apiretptr := NIL;
newinfoline := '';
strtosrchfor := 'FoX';
uptocharnum := 16;
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
newinfoline := 'StrStrNIW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNIW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNIW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNIW returned NIL !';
Memo1.Lines.Add(newinfoline);
strtosrchfor := 'FENCE';
uptocharnum := 42;
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
newinfoline := 'StrStrNIW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNIW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNIW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNIW returned NIL !';
Memo1.Lines.Add(newinfoline);
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
strtosrchfor := 'fox';
uptocharnum := Length(txttosearch); // = is the length of the string being searched
newinfoline := 'StrStrNIW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNIW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNIW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNIW returned NIL !';
Memo1.Lines.Add(newinfoline);
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
strtosrchfor := 'T';
uptocharnum := 1;
newinfoline := 'StrStrNIW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNIW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNIW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNIW returned NIL !';
Memo1.Lines.Add(newinfoline);
txttosearch := 'The quick, brown fox jumped over the fence and hid in the fox burrow';
strtosrchfor := 'T';
uptocharnum := 0;
newinfoline := 'StrStrNIW called with lpFirst (without the quotation marks) = "' + txttosearch + '", lpSrch = ' +
strtosrchfor + ', and cchMax = ' + IntToStr(uptocharnum);
Memo1.Lines.Add(newinfoline);
apiretptr := StrStrNIW(PWChar(txttosearch), PWChar(strtosrchfor), uptocharnum);
IF apiretptr <> NIL THEN
newinfoline := 'StrStrNIW returned a pointer to "' + PWChar(apiretptr) + '"'
ELSE
newinfoline := 'StrStrNIW returned NIL !';
Memo1.Lines.Add(newinfoline);
Memo1.Lines.Add('');
END;
{$ENDIF} |
StrStrNIW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = FoX, and cchMax = 16
StrStrNIW returned NIL !
StrStrNIW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = FENCE, and cchMax = 42
StrStrNIW returned a pointer to "fence and hid in the fox burrow"
StrStrNIW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow", l
pSrch = fox, and cchMax = 68
StrStrNIW returned a pointer to "fox jumped over the fence and hid in the fox burrow"
StrStrNIW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = T, and cchMax = 1
StrStrNIW returned a pointer to "The quick, brown fox jumped over the fence and hid in the fox burrow"
StrStrNIW called with lpFirst (without the quotation marks) =
"The quick, brown fox jumped over the fence and hid in the fox burrow",
lpSrch = T, and cchMax = 0
StrStrNIW returned NIL ! |